﻿
using OpenCvSharp;

using Xc.DataAccess.CodeReader.Properties;
using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    /// <summary>
    /// 漫水填充
    /// </summary>
    [Filter("漫水填充", FilterType.Algorithm)]
    public class AlgorithmFloodFill: FilterBase
    {
        /// <summary>
        /// 位置
        /// </summary>
        [InputParameter("位置")]
        public CVPoint SeedPoint { get; set; } = new CVPoint();
        /// <summary>
        /// 颜色
        /// </summary>
        [InputParameter("颜色")]
        public Scalar Color { get; set; }
        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterInfos, FilterBase preFilterBase)
        {
            Cv2.FloodFill(mat, SeedPoint,Color);
            return ResultData<Mat>.Accept(TextResource.filter_action_complete, mat);
        }
    }
}
